package com.zbkj.crmeb.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 资金流转类型
 * @Description: 
 * @author daigb
 * @date 2021-09-16
 */
public enum AccountFlowTypeEnum implements IEnum<Integer> {
    /**
     * 商品购买与退款
     */
    PRODUCT(1, "商品购买与退款"),
    
    /**
     * 商户充值与提现
     */
    RECHARGE(2, "商户充值与提现"),

    /**
     * 会员购买
     */
    MEMBER(3, "会员购买"),

    ;

    private final Integer code;
    private final String msg;

    AccountFlowTypeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    @JsonCreator
    public static AccountFlowTypeEnum valueOf(Integer code) {
        for (AccountFlowTypeEnum value : values()) {
            if (code.equals(value.getCode())) {
                return value;
            }
        }
        return AccountFlowTypeEnum.PRODUCT;
    }

    @Override
    @JsonValue
    public Integer getValue() {
        return code;
    }

}

